from selenium.webdriver.common.by import By
from selenium import webdriver


class WangYiPlayer:
    def __init__(self, postNum, postPass, phoneNum, webNum, webPass, qqNum, qqPass):
        self.driver = webdriver.Chrome()
        self.driver.get("https://music.163.com/")
        self.postNum = postNum
        self.postPass = postPass
        self.phoneNum = phoneNum
        self.webNum = webNum
        self.webPass = webPass
        self.qqNum = qqNum
        self.qqPass = qqPass

    def Login(self, LoginPlatform):
        self.driver.find_element(By.XPATH, "/html/body/div[1]/div[1]/div/div[1]/a").click()
        self.driver.find_element(By.XPATH, "/html/body/div[7]/div/div[2]/div/div[2]/div/div/div/a").click()  # 点击其他方式登录
        self.driver.find_element(By.XPATH,
                                 "/html/body/div[7]/div/div[2]/div/div[2]/div/div/div/div[2]/input").click()  # 同意条款
        loginPlatform = LoginPlatform
        if loginPlatform == "QQ登录":
            self.driver.find_element(By.XPATH,
                                     "/html/body/div[7]/div/div[2]/div/div[2]/div/div/div/div[1]/div[2]/ul/li[2]/a").click()
            self.QQ_Login(self.qqNum, self.qqPass)

        elif loginPlatform == "网易邮箱登录":
            self.driver.find_element(By.XPATH,
                                     "/html/body/div[7]/div/div[2]/div/div[2]/div/div/div/div[1]/div[2]/ul/li[4]/a").click()
            self.WangYi_Login(self.postNum, self.postPass)

        elif loginPlatform == "微博登录":
            self.driver.find_element(By.XPATH,
                                     "/html/body/div[7]/div/div[2]/div/div[2]/div/div/div/div[1]/div[2]/ul/li[3]/a").click()
            self.Weibo_Login(self.webNum, self.webPass)

        elif loginPlatform == "手机号登录":
            self.driver.find_element(By.XPATH,
                                     "/html/body/div[7]/div/div[2]/div/div[2]/div/div/div/div[1]/div[1]/a[1]/div").click()
            self.Phone_Login(self.phoneNum)

        else:
            print("用的啥玩意儿啊？")

    def QQ_Login(self, qqNum, qqPass):
        return None

    def WangYi_Login(self, postNum, postPass):
        return None

    def Weibo_Login(self, webNum, webPass):
        return None

    def Phone_Login(self, phoneNum):
        return None
